package service

import "api/app/auth/models"

func CreatePageTree(root int, pages []*models.Page) []*models.Page {
	//获取底层
	roots := make([]*models.Page, 0)
	for _, page := range pages {
		if page.ParentId == root && page.Type != "func" {
			roots = append(roots, page)
		}
	}
	for _, page := range roots {
		page.Children = CreatePageTree(page.Id, pages)
	}
	return roots
}
